/**
 * Copyright (c) 2017 ShopJsp. All Rights Reserved.
 * ============================================================================
 * 版权所有 2011 - 今 北京华宇盈通科技有限公司，并保留所有权利。
 * ----------------------------------------------------------------------------
 * 提示：在未取得SHOPJSP商业授权之前，您不能将本软件应用于商业用途，否则SHOPJSP将保留追究的权力。
 * ----------------------------------------------------------------------------
 * 官方网站：http://www.shopjsp.com
 * ============================================================================
 * @author 张丁方
 * @CreateTime 2017-3-30 18:09:32
 */
package com.hyyt.shopjsp.product.dao;

import com.hyyt.shopjsp.product.pojo.ShopBrand;
import com.hyyt.shopjsp.product.vo.ShopBrandVo;
import com.hyyt.shopjsp.util.dao.BaseMybatisDAO;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import org.apache.log4j.Logger;

import java.util.List;
import java.util.Map;

/**
* shop_brand, SHOP_商品品牌表
*
* @author Robot 2017-03-30 18:09:32
*/
@Repository
public class ShopBrandDAO extends BaseMybatisDAO<ShopBrand, Integer> {
    /**
    * 生成日志对象
    */
    private static  final Logger logger = Logger.getLogger(ShopBrandDAO.class);

    /**
     * 热销品牌统计列表
     * @param params
     * @param startRow
     * @param rowSize
     * @return
     */
    public List<ShopBrandVo> queryHotBrandStatistics(Map<String, Object> params, int startRow, int rowSize) {
        return getSqlSession().selectList(sqlmapNamespace + "." + "queryHotBrandStatistics",params ,new RowBounds(startRow, rowSize));
    }

    /**
     * 热销品牌数量
     * @param params
     * @return
     */
    public int countHotBrandStatistics(Map<String, Object> params) {
        return (Integer) getSqlSession().selectOne(sqlmapNamespace + "." + "countHotBrandStatistics", params);
    }

    /**
     *　根据商品分类ID获得品牌分类信息列表
     * @param params
     * @param startRow
     * @param rowSize
     * @return
     */
    public List<ShopBrand> queryShopBrandByProductTypeId(Map<String, Object> params, int startRow, int rowSize) {
        return getSqlSession().selectList(sqlmapNamespace + "." + "queryShopBrandByProductTypeId",params ,new RowBounds(startRow, rowSize));
    }

    /**
     * 根据商品分类ID获得品牌分类数量
     * @param params
     * @return
     */
    public int countShopBrandByProductTypeId(Map<String, Object> params) {
        return (Integer) getSqlSession().selectOne(sqlmapNamespace + "." + "countShopBrandByProductTypeId", params);
    }

    /**
     *　查找不在商品分类中的品牌分类
     * @param params
     * @param startRow
     * @param rowSize
     * @return
     */
    public List<ShopBrand> queryShopBrandNotIn(Map<String, Object> params, int startRow, int rowSize) {
        return getSqlSession().selectList(sqlmapNamespace + "." + "queryShopBrandNotIn",params ,new RowBounds(startRow, rowSize));
    }

    /**
     * 查找不在商品分类中的品牌分类数量
     * @param params
     * @return
     */
    public int countShopBrandNotIn(Map<String, Object> params) {
        return (Integer) getSqlSession().selectOne(sqlmapNamespace + "." + "countShopBrandNotIn", params);
    }

}